home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / rexx / mergescans.rexx < prev    next >
OS/2 REXX Batch file  |  1995-06-05  |  2KB  |  108 lines

  1. /*************************************/
  2. /* Image Engineer Macro script       */
  3. /* by Simon Edwards                  */
  4. /* 5/6/95                            */
  5. /* Merge Scans                       */
  6. /*************************************/
  7.  
  8. Options results
  9. signal on error            /* Setup a place for errors to go */
  10.  
  11. 'GET PRIMARY'
  12. primary=RESULT
  13. if primary="" then do
  14.     'REQUEST "No image has been marked as PRIMARY" "Doh!"'
  15.     exit
  16. end
  17.  
  18. 'GET SECONDARY'
  19. secondary=RESULT
  20. if secondary="" then do
  21.     'REQUEST "No image has been marked as SECONDARY" "Doh!"'
  22.     exit
  23. end
  24.  
  25. 'PROJECT_INFO "'||primary||'" BOX'
  26. coords=RESULT
  27. px=word(coords,1)
  28. py=word(coords,2)
  29.  
  30. 'PROJECT_INFO "'||secondary||'" BOX'
  31. coords=RESULT
  32. sx=word(coords,1)
  33. sy=word(coords,2)
  34.  
  35. 'PROJECT_INFO "'||primary||'" WIDTH'
  36. pwidth=RESULT
  37.  
  38. 'PROJECT_INFO "'||secondary||'" WIDTH'
  39. swidth=RESULT
  40.  
  41. 'PROJECT_INFO "'||primary||'" HEIGHT'
  42. pheight=RESULT
  43.  
  44. 'PROJECT_INFO "'||secondary||'" HEIGHT'
  45. sheight=RESULT
  46.  
  47. cx=px-sx
  48. cy=py-sy
  49.  
  50. if cx<0 then
  51.     resizexoffset=0-cx
  52. else
  53.     resizexoffset=0
  54.  
  55. if cy<0 then
  56.     resizeyoffset=0-cy
  57. else
  58.     resizeyoffset=0
  59.  
  60. if cx<0 then
  61.     cleft=cx
  62. else
  63.     cleft=0
  64. if pwidth<cx+swidth then
  65.     cright=cx+swidth
  66. else
  67.     cright=pwidth
  68. resizewidth=cright-cleft
  69.  
  70. if cy<0 then
  71.     ctop=cy
  72. else
  73.     ctop=0
  74. if pheight<cy+sheight then
  75.     cbottom=cy+sheight
  76. else
  77.     cbottom=pheight
  78. resizeheight=cbottom-ctop
  79.  
  80. 'RESIZE "'||primary||'"' resizewidth resizeheight resizexoffset resizeyoffset
  81. resizedimage=RESULT
  82.  
  83. 'MARK "'||secondary||'" PRIMARY'
  84. 'MARK "'||resizedimage||'" SECONDARY'
  85. COMPOSITE cx+resizexoffset cy+resizeyoffset MIX 100
  86.  
  87. CLOSE resizedimage
  88.  
  89. exit
  90.  
  91. /*******************************************************************/
  92. /* This is where control goes when an error code is returned by IE */
  93. /* It puts up a message saying what happened and on which line     */
  94. /*******************************************************************/
  95. error:
  96. if RC=5 then do            /* Did the user just cancel us? */
  97.     IE_TO_FRONT
  98.     LAST_ERROR
  99.     'REQUEST "'||RESULT||'"'
  100.     exit
  101. end
  102. else do
  103.     IE_TO_FRONT
  104.     LAST_ERROR
  105.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  106.     exit
  107. end
  108.